package com.example.saiweisi.controller.userController;

import com.example.saiweisi.common.Result;
import com.example.saiweisi.controller.request.HistoryOrderRequest;
import com.example.saiweisi.service.interf.IClothesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/clothes")
@RestController
@CrossOrigin
@Slf4j
public class ClothesController {
    @Autowired
    IClothesService clothesService;

    /**
     * 根据用户ID查询所有不在洗衣馆并且衣服样式材质并未被删除的衣物，用作选择已有衣物
     * @param userId 用户ID
     * @return 衣物信息列表
     */
    @GetMapping("/getclothesbyuserid/{userId}")
    public Result getHistoryOrder(@PathVariable Integer userId){
        return Result.success(clothesService.getClothesByUserId(userId));
    }
    @PutMapping("/isbad/{clothesId}")
    public Result isbad(@PathVariable Integer clothesId){
        clothesService.isbad(clothesId);
        return Result.success();
    }
    @PutMapping("/nextstep/{clothesId}")
    public Result nextstep(@PathVariable Integer clothesId){
        clothesService.nextstep(clothesId);
        return Result.success();
    }
    @PutMapping("/finish/{clothesId}")
    public Result finish(@PathVariable Integer clothesId){
        clothesService.finish(clothesId);
        return Result.success();
    }
}
